#include <iostream>
#include <unistd.h>
#include "threadpool.hpp"

int Add(int num1, int num2)
{
    return num1 + num2;
}

int main()
{
    threadpool pool(5);
    for (int i = 0; i < 10; i++)
    {
        int rand1 = rand() % 100;
        int rand2 = rand() % 100;
        std::future<int> fu = pool.push(Add, rand1, rand2);
        std::cout << rand1 << "+" << rand2 << "=" << fu.get() << std::endl;
        sleep(1);
    }
    pool.stop();
    return 0;
}